export * from "@/interface/interface";

// --------------entity interface-------------------
export interface PermissionMap {
  // system
  projectSystem: string;
  incomeStreamSystem: string;
  outlayStreamSystem: string;

  // user
  updateMyUser: string;

  // project
  queryAllProject: string;
  addProject: string;
  deleteProject: string;
  updateProject: string;

  // incomestream
  queryAllIncomeStream: string;
  addIncomeStream: string;
  deleteIncomeStream: string;
  updateIncomeStream: string;

  // outlaystream
  queryAllOutlayStream: string;
  addOutlayStream: string;
  deleteOutlayStream: string;
  updateOutlayStream: string;
}

export interface User {
  // primary key
  userID?: number;
  username: string;
  password: string;
  userRole: string;
  // PermissionMap[]是为了用封装好的table组件方便渲染。实际上一个
  permissionString: string;
  // system
  projectSystem?: string;
  incomeStreamSystem?: string;
  outlayStreamSystem?: string;

  // user
  updateMyUser?: string;

  // project
  queryAllProject?: string;
  addProject?: string;
  deleteProject?: string;
  updateProject?: string;

  // incomestream
  queryAllIncomeStream?: string;
  addIncomeStream?: string;
  deleteIncomeStream?: string;
  updateIncomeStream?: string;

  // outlaystream
  queryAllOutlayStream?: string;
  addOutlayStream?: string;
  deleteOutlayStream?: string;
  updateOutlayStream?: string;
}

export interface Project {
  // guid唯一标识，数据库主键
  projectGuid: string;
  // 创建者
  creator: string;
  // 项目负责人
  projectManager: string;
  // 项目名
  projectName: string;
  // 区域
  selectedArea: string | string[];
  // 收费标准
  chargeStandard: string;
  // 项目应收经费
  projectFund: number;
  // 已到账金额
  paidAmount?: number;
  // 未到账金额
  unpaidAmount?: number;
  // 项目分类
  categories: string;
  // 项目创建日期
  createdDate?: string | Date;
  // 项目码
  projectNum: string;
  // 培训模式
  trainingMode: string;
  // 培训人数
  trainingNumOfPerson: string;
  // 培训学时数
  trainingTimes: string;
  // 培训起止时间
  trainingStartTime?: string | Date;
  trainingEndTime?: string | Date;
  // 合同编号
  contractNum: string;
  // 合同起止时间
  contractStartTime?: string | Date;
  contractEndTime?: string | Date;
  // 委托方，和落地机构一个类型
  clients: string | LandingAgency[];
  //落地机构和技术合作方
  landingAgencies: string | LandingAgency[];
  partners: string | Partners[];
  // 学校管理费。。等比例
  schoolManageRadio: number;
  devFundingRadio: number;
  welfareRadio: number;
  classPayRadio: number;
  // 学校管理费(180043)
  schoolManageAmount?: number;
  // 发展基金
  devFundingAmount?: number;
  // 福利220121（40%非区域）或15%（区域）
  welfareAmount?: number;
  // 课酬440120（20%）
  classPayAmount?: number;
  // 支出
  outlayAmount?: number;
  // 盈亏金额
  profitlossAmount?: number;
  // pay
  payGin: number;
  payHin: number;
  payIin: number;
  payJin: number;
  payKin: number;
  payLin: number;
  payMin: number;
  payNin: number;
  payOin: number;
  payPin: number;
  payQin: number;
  payRin: number;
  paySin: number;
  payTin: number;
  // pay
  payGout: number;
  payHout: number;
  payIout: number;
  payJout: number;
  payKout: number;
  payLout: number;
  payMout: number;
  payNout: number;
  payOout: number;
  payPout: number;
  payQout: number;
  payRout: number;
  paySout: number;
  payTout: number;
}

// ----------------resource-------------------

export interface Resource {
  name: string;
  url: Blob;
  createdDate: string;
}
export interface ProjectResource {
  // ---项目资源---
  discription: string;
  fileType: string;
  resource: Resource[];
}
export interface ProjectResources {
  projectGuid: string;
  resources: ProjectResource[];
}
export interface LandingAgency {
  agencyName: string;
  shareRadio: number;
  shareAmount: number;
}
export interface Partners {
  partnerName: string;
  shareRadio: number;
  shareAmount: number;
  partnerType: string;
  // 是否要按公式来（如弘成）
  caculation: string;
}
// use when adding a incomeSTREAM
export interface IncomeStream {
  // primary key
  streamID?: number;

  // 修改前的入账金额
  oldIncomeAmount?: number;

  projectGuid: string;
  isBorrowed: string;
  isOffset: string;
  payUnit: string;
  // 入账日期
  createdDate: Date | string;
  incomeAmount: number;
  invoice: string;
  incomeValidCode: string;

  invoiceIssueDate: Date | string;
  invoiceAmount: number;
  invoiceCount: number;
  invoiceCode: string;
  // 分账日期
  splitAmountDate: string | Date;

  // todo 委托方、落地机构、合作方，数组形式，不保存在数据库中
  clients: string | LandingAgency[];
  landingAgencies: string | LandingAgency[];
  partners: string | Partners[];

  // 这些额外的数据从当前项目中获取，不存在incomestream中
  categories?: string;
  projectNum?: string;
  projectName?: string;

  // 学校管理费(180043)
  schoolManageAmount?: number;
  // 发展基金
  devFundingAmount?: number;
  // 福利220121（40%非区域）或15%（区域）
  welfareAmount?: number;
  // 课酬440120（20%）
  classPayAmount?: number;
  // 学校管理费。。等比例
  schoolManageRadio?: number;
  devFundingRadio?: number;
  welfareRadio?: number;
  classPayRadio?: number;
  // pay
  payG: number;
  payH: number;
  payI: number;
  payJ: number;
  payK: number;
  payL: number;
  payM: number;
  payN: number;
  payO: number;
  payP: number;
  payQ: number;
  payR: number;
  payS: number;
  payT: number;
  // 备注
  remarks?: string;
}

// outlayStream stored in db
export interface OutlayStream {
  // primary key
  streamID?: number;

  // 修改前的支出金额
  oldTotalPay: number;

  // 支出日期
  createdDate: Date | string;

  projectGuid: string;

  // data from the project
  projectName?: string;
  categories?: string;

  outlayProjectCode: string;
  // todo client
  clients: string | LandingAgency[];
  // the shareAmount of landingAgencies and partners，unique，will not affect the shareAmount in the project and incomestream
  landingAgencies: string | LandingAgency[];
  partners: string | Partners[];
  // pays
  payG: number;
  payH: number;
  payI: number;
  payJ: number;
  payK: number;
  payL: number;
  payM: number;
  payN: number;
  payO: number;
  payP: number;
  payQ: number;
  payR: number;
  payS: number;
  payT: number;
  totalPay: number;
}

// ----------------system setting-------------------
export interface SystemSetting {
  guid: string;
  projectTablePattern: string;
  incomeStreamTablePattern: string;
  outlayStreamTablePattern: string;
  adminTablePattern: string;
}
